/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.za.cput.xalisa.designpatterns.structural.proxy;

/**
 *
 * @author Enkosi
 */
public class ATMProxy {

    public double getMoneyForPurchase(double amountNeeded) {
        AccountHolder accountHolder = new AccountHolder("Xalisa");
        Account account = new Account();

        boolean isBalanceAvailable = false;
        if (accountHolder.getCard()) {
            isBalanceAvailable = account.checkBalance(accountHolder.getAccountNumber(), amountNeeded);
        }

        if (isBalanceAvailable) {
            return amountNeeded;
        } else {
            return 0;
        }
    }
}
